home *** CD-ROM | disk | FTP | other *** search
/ The Arsenal Files 6 / The Arsenal Files 6 (Arsenal Computer).ISO / os2 / spllmstr.zip / KILLBN.CMD < prev    next >
OS/2 REXX Batch file  |  1996-01-24  |  836b  |  30 lines

  1. /* program: killbyname  (a freeby)
  2. ** written: Stan J. Towianski
  3. ** purpose: killbyname arg, will kill the 1st process that matches the
  4. **          name given in arg.
  5. **    date: 1995
  6. **    note: needs to have kill.exe program in path.
  7. **          This can be found in c:\grpware\clients from OS/2 Warp 3.0
  8. **          Also uses hardcoded filename of c:\out which can be 
  9. **          changed.
  10. */
  11.  
  12. parse upper arg searchname
  13. listfile = "c:\out"
  14. "pstat /c > c:\out"
  15.  
  16. Do While( lines( listfile ) )
  17.     word = linein( listfile )
  18.     parse var word pid . . procname rest
  19.     say "pid ="pid     "procname ="procname"="
  20.     if ( pos( searchname, procname ) > 0 ) then
  21.         Do
  22.         decpid = x2d( pid )
  23.         "kill "decpid
  24.         leave
  25.         End
  26. End
  27. rc = stream( listfile, 'c', "close" )
  28. "del "listfile
  29.  
  30.